import 'pages/login.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart' as cupertino;
import 'tabs.dart';
import 'pages/register.dart';

final routes = {
  "/login": (context) => Login(),
  "/main": (context, {arguments}) => Tabs(),
  "/register": (context) => Register(),
};

var onGenerateRoute = (RouteSettings settings) {
  final String name = settings.name!;
  print("name:$name");
  final dynamic pageBuilder = routes[name];

  if (pageBuilder != null) {
    if (settings.arguments == null) {
      return cupertino.CupertinoPageRoute(builder: (context) {
        return pageBuilder(context);
      });
    } else {
      return cupertino.CupertinoPageRoute(builder: (context) {
        return pageBuilder(context, arguments: settings.arguments);
      });
    }
  }
};
